package com.test.account.service.impl;

import com.test.account.dao.AccountDao;
import com.test.account.pojo.Account;
import com.test.account.service.AccountService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.util.List;

/**
 * Created by 57695 on 2017/3/12.
 */
@Service
public class AccountServiceImpl implements AccountService {

    @Autowired
    private AccountDao accountDao;
    @Override
    public List<Account> getAccounts() {
        return accountDao.queryAll();
    }

    @Override
    public int deleteAccount(long code) {
        return accountDao.deleteByCode(code);
    }

    @Override
    public Account getAccountByCode(long code) {
        return accountDao.queryByCode(code);
    }

    @Override
    public int updateAccount(Account account, long code) {
        return accountDao.updateByCode(account,code);
    }

    @Override
    public int addAccount(Account account) {
        return accountDao.insert(account);
    }

    @Override
    public List<Account> ExecuteSql(String sql) {
        return accountDao.queryBySql(sql);
    }
}
